package com.example.mypicproject;



import android.Manifest;
import android.content.pm.PackageManager;

import android.os.Bundle;


import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;

import com.example.modulepicselector.MyMatisse;

import com.example.modulepicselector.engine.impl.ImageTanEngine;
import com.example.modulepicselector.engine.impl.PicassoEngine;



public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        requestPermission(Manifest.permission.READ_EXTERNAL_STORAGE);
        requestPermission( Manifest.permission.WRITE_EXTERNAL_STORAGE);//        new LoadLocalPhoto(this).setLoadFinishCallback(folderList -> System.out.println("我来了"+folderList));

        MyMatisse.from(this).choose().maxSelectable(9).countable(true).imageEngine(new ImageTanEngine()).countable(true).maxSelectable(6).forResult(1);
/*        ImageView imageView = findViewById(R.id.imageview);
        TanLoadPic.get(this).load(Uri.parse("content://media/external/images/media/43011")).into(imageView);*/
    }

    /**
     * 动态申请权限
     *
     * @param permission 要申请的权限
     */
    private void requestPermission(String permission) {
        if (!(ActivityCompat.checkSelfPermission(this, permission) ==
                PackageManager.PERMISSION_GRANTED))
            ActivityCompat.requestPermissions(this, new String[]{permission}, 1024);
    }
}